<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
    <style type="text/css">
        table{
            border-collapse: collapse;
            font-size: 14px;
            width: 80%;
            margin: auto;
        }
        table,th,td{
            border: 1px solid darkslategray;
            padding: 10px;
        }
    </style>
</head>
<body>
<center>
    <form action="findByPage" method="post">
    <input type="text" name="name">
    <input value="查询" type="submit">
    </form>
<div style="text-align: center" >
    <span>学生信息系统</span>
    <hr>
    <table border="1">
        <tr>
            <td>id</td>
            <td>姓名</td>
            <td>班级名</td>
            <td>成绩</td>
        </tr>
        <tr th:each="p:${page.list}">
            <td th:text="${p.id}">1</td>
            <td th:text="${p.name}">将军</td>
            <td th:text="${p.studentclass}">狡猾的慧宇</td>
            <td th:text="${p.score}">18</td>
        </tr>
    </table>
</div>

    <!--分页代码-->
    <div>
        <a th:if="${page.pageNum>1}" th:href="@{'findByPage?pageNum=1&name='+${name}}">首页</a>
        <a th:if="${page.pageNum>1}" th:href="@{'findByPage?pageNum='+${page.pageNum-1}+'&name='+${name}}">上一页</a>
        <span th:each="pageNum:${#numbers.sequence(1,page.endPage)}">
                <a th:href="@{'findByPage?pageNum='+${pageNum}+'&name='+${name}}"
                   th:text="${pageNum}"></a>
        </span>
        <a th:if="${page.pageNum<page.endPage}" th:href="@{'findByPage?pageNum='+${page.pageNum+1}+'&name='+${name}}">下一页</a>
        <a th:if="${page.pageNum<page.endPage}" th:href="@{'findByPage?pageNum='+${page.endPage}+'&name='+${name}}">尾页</a>
    </div>
</center>

</body>
</html>